import java.beans.XMLDecoder;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Calendar;

public class SerializationExampleRead
{
 public static void main(String [] args)
 {
  String filename = "ser.xml";
     if(args.length > 0)
     {
       filename = args[0];
     }
   Object time = null;
   FileInputStream fis = null;
   XMLDecoder in = null;
   try
   {
     fis = new FileInputStream(filename);
     in = new XMLDecoder(fis);
     time = in.readObject();
     in.close();
   }
   catch(IOException ex)
   {
     ex.printStackTrace();
   }
   // print out restored time
   System.out.println("Flattened time: " + ((PersistentTime)time).getTime());
   System.out.println();
      // print out the current time
   System.out.println("Current time: " + Calendar.getInstance().getTime());
 }
}
